<!--
 * @Author: boyyang
 * @Date: 2022-01-08 19:25:47
 * @LastEditTime: 2022-02-13 12:04:51
 * @LastEditors: boyyang
 * @Description: 
 * @FilePath: \boyyang\src\views\home\components\homeBackground.vue
-->

<template>
    <div class="home-background">
        <video :src="props.url" muted autoplay loop v-if="props.type == 'video'"></video>
        <img :src="props.url" v-else />
    </div>
</template>

<script lang="ts" setup>
interface IHomeBackgroundProps {
    url?: string;
    type?: string
}

const props = withDefaults(defineProps<IHomeBackgroundProps>(), {

})
</script>

<style scoped lang="scss">
.home-background {
    box-sizing: border-box;
    width: 100vw;
    height: 100vh;
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
    z-index: 0;

    background-image: url('@/assets/海琴烟\ 同人\ cosplay美女4K高清壁纸_彼岸图网.jpg');
    background-size: cover;
    background-position: center;
    video {
        width: 100%;
    }

    img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
}

@media screen and (max-width: 1600px) {
    .home-background {
        video {
            width: 100%;
            height: 100%;

            object-fit: cover;
        }
    }
}

// @media screen and (max-width: 500px) {
//     .home-background {
//         background-image: url("@/assets/g-4.jpeg");
//         background-size: cover;
//         background-position: center;
//         video {
//             display: none;
//         }
//     }
// }
</style>
